// pages/index/online_answer/answer_sheet/answer_sheet.js
import Toast from "../../../../miniprogram_npm/@vant/weapp/toast/toast"
import Dialog from "../../../../miniprogram_npm/@vant/weapp/dialog/dialog"

const app = getApp()
const log = new app.appLogs()
const http = new app.appHttp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        answerSheet: {},
        paperid: ""
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            paperid: options.id
        })
        this.getAnswerSheet()
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    },
    getAnswerSheet: function (e) {
        http.get("questions/open/getQuesTestPaper", {
            paperid: this.data.paperid,
            applet_user_id: app.globalData.userInfo.applet_user_id,
        }).then(res => {
            if (res.data.code == 200) {
                this.setData({
                    answerSheet: res.data.data
                })
            }
        })
    },
    sonSubjec: function (e) {
        http.put("questions/open/addVisit", {
            paperid: this.data.paperid
        }).then(res => {

        })
        wx.navigateTo({
            url: "../subject_answer/subject_answer?paperid=" + this.data.paperid
        })
    },
    onSubjecDetails: function (e) {
        wx.navigateTo({
            url: "../subjec_details/subjec_details?paperid=" + this.data.paperid
        })
    }
})